Find the longest word in the listΒΆ
Write a python function that takes a list of words
and returns the length of the longest one.
def find_longest_word(L):
word_len = []
for n in L:
word_len.append((len(n), n))
word_len.sort()
return word_len[-1][1]
# test
L = ["PHP", "Exercises", "Backend"]
print(find_longest_word(L)) # Exercises